package 力扣日常刷题.木23一月.第08天308;

/**
 * @author 帅小伙
 * @date 2022/3/8
 * @description
 */
public class Demo26反转单词序列 {


    public String reverseWords(String s) {
        s = s.trim();
        String[] s1 = s.split(" ");
        StringBuilder sb = new StringBuilder();

        for (int i = s1.length - 1; i >=0 ; i--) {
            sb.append(s1[i]).append(" ");
        }
        return sb.toString().substring(0,sb.length() - 1);
    }
}
